package biz.ws;

import biz.ws.ws.WsCst;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @创建人 wsdc
 * @时间 2021/4/2
 * @描述 $
 */
@ConfigurationProperties(prefix = "ws")
@Setter
@Getter
public class WsConfig {
    /**
     *  {@link #port}           ws的端口
     *  {@link #maxConnect}     最大的连接数
     *  {@link #maxBodySize}    报文最大的长度 4k
     *  {@link #endPoint}       请求的路径
     *  {@link #beatTime}       心跳时间
     *  {@link #backlog}        tcp握手缓冲的大小
     *  {@link #ioThreads}      netty io线程池大小
     *  {@link #workThreads}    netty work线程池大小
     *
     *  {@link #enabled}        是否开启 ws server
     *  {@link #loginType}      登录的校验方式 {@link biz.ws.ws.WsCst.LoginType}
     */
    private int port = 7777;
    private int maxConnect = 16000;
    private int maxBodySize = 1024 * 4;
    private String endPoint = "/ws/ksv.do";
    private int beatTime = 30;
    private int backlog = 512;
    private int ioThreads = 1;
    private int workThreads = 1;
    private boolean enabled = true;
    private String loginType = WsCst.LoginType.DIRECT;

    /**
     *  分片的相关参数
     *  {@link #sharedSize}     总的分片大小
     *  {@link #shared}         当前的分片值
     *  {@link #sharedLink}     关联的分片值
     *  {@link #sharedTemp}     是否需要开启当前节点位临时节点 (防止其他节点宕机)
     *  {@link #publicUrl}      当前节点的发布地址
     *  {@link #checkLinkInLineTime}    检测关联节点在线情况
     *
     *  {@link #groupIdMain}    主节点的订阅组
     *  {@link #groupIdTemp}    临时节点的订阅组
     */
    private int sharedSize = 1;
    private int shared = 0;
    private int sharedLink = 0;
    private boolean sharedTemp = false;
    private String publicUrl;
    private int checkLinkInLineTime = 30;

    private String groupIdMain;
    private String groupIdTemp;
}
